package com.unitd.modules.sys.service.impl;

import com.unitd.frame.mybatis.core.dao.IBaseDao;
import com.unitd.frame.mybatis.core.service.impl.BaseServiceImpl;
import com.unitd.modules.sys.dao.ISysUserRoleDao;
import com.unitd.modules.sys.entity.SysUserRole;
import com.unitd.modules.sys.service.ISysUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @desc 用户-角色业务逻辑控制接口实现类
 * @filename SysUserRoleServiceImpl.java
 * @copyright www.unitd.com
 * @author Hudan
 * @version 1.0
 * @date 2017-04-08
 */
@Service("sysUserRoleService")
public class SysUserRoleServiceImpl extends BaseServiceImpl<SysUserRole, String> implements ISysUserRoleService {

	@Autowired
	private ISysUserRoleDao sysUserRoleDao;

	/**
	 * @return GenericDao实现类
	 * @desc 定义成抽象方法, 由子类实现, 完成dao的注入
	 */
	@Override
	public IBaseDao<SysUserRole, String> getDao() {
		return sysUserRoleDao;
	}

	/**
	 * @desc 根据用户ID获取该用户对应的角色菜单列表
	 * @param userId 用户ID
	 * @return
	 */
	@Override
	public List<String> findRoleIdsByUserId(String userId) {
		return sysUserRoleDao.findRoleIdsByUserId(userId);
	}
}